﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TalkBot
{
    class Robot
    {
        public Robot()
        {
            m_repository = new Repository();
        }

        public void Answer(string input)
        {
            if (input.ToLower().Contains("sad") || input.ToLower().Contains("job") || input.ToLower().Contains("love") || input.ToLower().Contains("sex"))
            {
                Random randGen = new Random(System.DateTime.UtcNow.Millisecond);
                List<String> awkwardVocab = m_repository.GetVocabularyByCategory(Repository.VocabularyCategory.VocabularyCategory_Awkward);
                int index = randGen.Next(awkwardVocab.Count);
                Console.WriteLine(awkwardVocab[index]);
            }
            else if (input.ToLower().Contains("fuck") || input.ToLower().Contains("bitch"))
            {
                Random randGen = new Random(System.DateTime.UtcNow.Millisecond);
                List<String> rudeVocab = m_repository.GetVocabularyByCategory(Repository.VocabularyCategory.VocabularyCategory_Rude);
                int index = randGen.Next(rudeVocab.Count);
                Console.WriteLine(rudeVocab[index]);
            }
            else
            {
                Random randGen = new Random(System.DateTime.UtcNow.Millisecond);
                List<String> kindVocab = m_repository.GetVocabularyByCategory(Repository.VocabularyCategory.VocabularyCategory_Kind);
                int index = randGen.Next(kindVocab.Count);
                Console.WriteLine(kindVocab[index]);
            }


        }

        public void OpenRepository(string filename)
        {
            m_repository.Initilize(filename);
        }

        public Repository GetRepository()
        {
            return m_repository;
        }

        private Repository m_repository;
    }
}
